Skip to content

Reland "[lldb] Clear thread-creation breakpoints in ProcessGDBRemote::Clear (#134397)" #10479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

felipepiovezan
Copy link

This reverts and relands the commit above, as per upstream discussions: llvm#135296

…:Clear (llvm#134397)" (llvm#135296)

This reapplies commit
llvm@232525f.

The original commit triggered a sanitizer failure when `Target` was
destroyed. In `Target::Destroy`, `DeleteCurrentProcess` was called, but
it did not destroy the thread creation breakpoints for the underlying
`ProcessGDBRemote` because `ProcessGDBRemote::Clear` was not called in
that path.

`Target `then proceeded to destroy its breakpoints, which resulted in a
call to the destructor of a `std::vector` containing the breakpoints.
Through a sequence of complicated events, destroying breakpoints caused
the reference count of the underlying `ProcessGDBRemote` to finally
reach zero. This, in turn, called `ProcessGDBRemote::Clear`, which
attempted to destroy the breakpoints. To do that, it would go back into
the Target's vector of breakpoints, which we are in the middle of
destroying.

We solve this by moving the breakpoint deletion into
`Process:DoDestroy`, which is a virtual Process method that will be
called much earlier.

(cherry picked from commit c2939b9)
@felipepiovezan felipepiovezan requested a review from a team as a code owner April 11, 2025 20:20
@felipepiovezan
Copy link
Author

@swift-ci test

@felipepiovezan
Copy link
Author

@swift-ci test windows platform

@adrian-prantl adrian-prantl merged commit 55e68a0 into swiftlang:swift/release/6.2 Apr 14, 2025
3 checks passed
@felipepiovezan felipepiovezan deleted the felipe/reland_threadcretiondeletion_62 branch April 14, 2025 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants